func monotoneIncreasingDigits(N int) int {
    s := strconv.Itoa(N)
    ss := []byte(s)
    n := len(ss)
    index9Start := n
    for i:=n-1; i>0; i-- {
        if ss[i] < ss[i-1] {
            index9Start = i
            ss[i-1] -= 1
        }
    }
    for i:=index9Start; i<n; i++ {
        ss[i] = '9'
    }
    ans, _ := strconv.Atoi(string(ss))
    return ans
}